package com.pointi.emoServerM;

import java.text.SimpleDateFormat;
import java.util.Date;

public class CheckStatus
{
	private String _ServerNo ;
	private long _StartTime ;
	private long _RunningTime ;
	private int _Count ;
	private int _CheckInterval ;

	public CheckStatus(String inServerNo, String inCheckInterval)
	{
		_ServerNo = inServerNo ;
		_Count = 0 ;
		_CheckInterval = Integer.valueOf(inCheckInterval) ;
		this.fnResetTime() ;
	}

	public boolean isNewDate()
	{
		String referenceTime = "00" ;
		String currentTime = "" ;
		SimpleDateFormat sdf = new SimpleDateFormat("HH") ; // [OPTION] HH(00~23) or kk(01~24)
		currentTime = sdf.format(new Date()) ;
		return currentTime.equals(referenceTime) ;
	}

	public void fnSetServerCount(int inCount)
	{
		_Count = inCount ;
	}
	
	public void fnResetTime()
	{
		_StartTime = System.currentTimeMillis() ;
		_RunningTime = System.currentTimeMillis() ;
	}
	
	public void fnSetRunningTime()
	{
		_RunningTime = System.currentTimeMillis() - _StartTime ;
	}
	
	public String fnGetServerNo()
	{
		return _ServerNo ;
	}
	
	public String fnGetServerStatus()
	{
		return String.valueOf(_RunningTime / 1000) ;
	}
	
	public String fnGetServerCount()
	{
		return String.valueOf(_Count) ;
	}
	
	public int fnGetCheckInterval()
	{
		return _CheckInterval ;
	}
}